home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / comm / www / UrbCedWWW.lha / urbcedwww / rexx / BldMap.ucwx < prev    next >
Encoding:
Text File  |  1998-09-30  |  3.6 KB  |  149 lines

  1. /**************************************************************************/
  2. /*                              BlbMap.ucwx                               */
  3. /*                                                                        */
  4. /*                    Copyright ©1998 by Dick Whiting                     */
  5. /*                                                                        */
  6. /*------------------------------------------------------------------------*/
  7. /*      Builds the client side MAP statements. Prompts for info.          */
  8. /*      Requires that GetPicSize.ucwx has been ENABLED.                   */
  9. /*      See the UrbCedWWW Readme for a more complete description.         */
  10. /**************************************************************************/
  11. /*
  12. $VER: 1.0 Copyright ©1998 by Dick Whiting
  13. */
  14.  
  15.  
  16. options results
  17. Address CYGNUSED
  18.  
  19. lf='0A'x
  20.  
  21. 'CEDTOFRONT'
  22.  
  23. title='Select image for MAP'
  24. Call Bldpath
  25. if filename='' then exit
  26.  
  27. 'TEXT' '<IMG SRC="'filename'"'
  28.  
  29. Call 'Rexx/GetPicSize.ucwx'
  30. sizes=result
  31. if sizes='' then exit
  32.  
  33. parse var sizes width height
  34.  
  35. 'TEXT' ' BORDER="0" USEMAP="#UCWmap" ALT="">'||lf
  36.  
  37. 'UP'
  38.  
  39. 'GETNUMBER' 5 '"MAP Areas"' 1
  40. divs=strip(result)
  41. if divs=0 then exit
  42.  
  43. 'GETSTRING' 'H' '"Enter orientation: H or V"'
  44. orient=upper(strip(result))
  45. select
  46.    when orient='H' | orient='V' then nop
  47.    when orient='RESULT' then exit
  48.    otherwise do
  49.       'OKAY1' 'Invalid value for orientation'
  50.    end
  51. end
  52.  
  53. 'GETSTRING' 'R' '"Enter shape: R or C"'
  54. shape=upper(strip(result))
  55. select
  56.    when shape='R' | shape='C' then nop
  57.    when shape='RESULT' then exit
  58.    otherwise do
  59.       'OKAY1' 'Invalid value for shape'
  60.    end
  61. end
  62.  
  63. 'TEXT' '<MAP NAME="UCWmap">'||lf
  64.  
  65. if shape='R' then do
  66.    x1=0
  67.    x2=width-1
  68.    y1=0
  69.    y2=height-1
  70. end
  71. else do
  72.    x1=0
  73.    y1=0
  74.    if orient='H' then do
  75.       offx=(width/divs)%2
  76.       offy=height%2
  77.    end
  78.    else do
  79.       offx=width%2
  80.       offy=(height/divs)%2   
  81.    end
  82.    rad=min(offx,offy)
  83. end
  84.  
  85. do i=1 to divs
  86.    title='Select file for area '||i
  87.    Call Bldpath
  88.    select
  89.       when orient='H' & shape='R' then do
  90.          if i~=divs then x2=(i*width)%divs
  91.          else x2=width-1
  92.          'TEXT' '   <AREA HREF="'filename'" ALT="" SHAPE="RECT" COORDS="'x1','y1','x2','y2'">'||lf
  93.          x1=x2+1
  94.       end
  95.       when orient='V' & shape='R' then do
  96.          if i~=divs then y2=(i*height)%divs
  97.          else y2=height-1
  98.          'TEXT' '   <AREA HREF="'filename'" ALT="" SHAPE="RECT" COORDS="'x1','y1','x2','y2'">'||lf
  99.          y1=y2+1
  100.       end
  101.       when orient='H' & shape='C' then do
  102.          'TEXT' '   <AREA HREF="'filename'" ALT="" SHAPE="CIRCLE" COORDS="'offx','offy','rad'">'||lf
  103.          offx=offx+(width%divs)
  104.       end
  105.       when orient='V' & shape='C' then do
  106.          'TEXT' '   <AREA HREF="'filename'" ALT="" SHAPE="CIRCLE" COORDS="'offx','offy','rad'">'||lf
  107.          offy=offy+(height%divs)
  108.       end
  109.       otherwise nop
  110.    end
  111. end
  112.  
  113. 'TEXT' '</MAP'||lf
  114.  
  115. exit
  116.  
  117. /**************************************************************************/
  118. /*         Build relative pathing. Force SAVE if necessary.               */
  119. /**************************************************************************/
  120. Bldpath:
  121.  
  122.    'STATUS RESTNAME'
  123.    rest=result
  124.    if rest='' then do
  125.       'OKAY1' "You must save the file first"
  126.       exit
  127.    end
  128.  
  129.    'STATUS FILENAME'
  130.    fullfn=result
  131.  
  132.    path=substr(fullfn,1,pos(rest,fullfn)-1)
  133.    'CHANGE CURRENT DIRECTORY' path
  134.  
  135.    'GETFILENAME' path '"'title'"'
  136.    filename=result
  137.    if filename='RESULT' then do
  138.       filename=''
  139.    end
  140.    else do
  141.       diff=compare(path,filename)
  142.       path=substr(path,diff)
  143.       filename=substr(filename,diff)
  144.       if path~='' then filename='../'||filename
  145.    end
  146.  
  147. return
  148.  
  149.